<?php

namespace App\Http\Controllers\Home;


use App\Models\Menu;
use App\Models\News;

class NewsController extends BaseController
{

    public function content($id)
    {
        $news = News::findOrFail($id);
        $menuId = $news->menu_id;
        $menu = $this->navMenu($menuId);
        return view($this->view . $menu->newsTpl, compact('news'));
    }

    public function lists($menuId)
    {
        //当前模块
        $menuId = $menuId;
        $menu = $this->navMenu($menuId);
        //列表
        $news = News::where('menu_id', $menuId)
            ->orderBy('id', 'desc')->paginate(10);
        return view($this->view . $menu->listTpl, compact('news'));
    }
}
